﻿using HYRN.Common.ConvertUtilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ChargingSystem4.EUc
{
    public partial class FormNum : Form
    {
        public decimal ResultVal = 0;
        public FormNum()
        {
            InitializeComponent();
            //  this.TopMost  = true;
        }

        public FormNum(int min, int max, decimal val, int DecimalPlaces = 0, string TextName = "")
        {
            InitializeComponent();

            lblA.Text = min.ToString();
            lblB.Text = max.ToString();

            numericUpDown1.Minimum = min;
            numericUpDown1.Maximum = max;
            if (val > max)
            {
                val = max;
            }

            numericUpDown1.Value = val;

            numericUpDown1.DecimalPlaces = DecimalPlaces;
            this.Text = TextName;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ResultVal = numericUpDown1.Value;
            this.DialogResult = DialogResult.OK;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}
